#include "cwframe.h"

CWFrame::CWFrame(Qt::WindowFrameSection sect, QWidget *parent, Qt::WindowFlags f) : QFrame(parent, f)
	{
		section = sect;
		switch(sect)
		{
			case Qt::TopSection:
				setCursor(Qt::SizeVerCursor);
				setSizePolicy(QSizePolicy::MinimumExpanding,
							  QSizePolicy::Maximum);
				setStyleSheet("min-height: 5px; max-height: 5px; background-color: transparent;");
				setObjectName("frameTop");
			break;
			case Qt::TopLeftSection:
				setCursor(Qt::SizeFDiagCursor);
				setSizePolicy(QSizePolicy::Maximum,
							  QSizePolicy::Maximum);
				setStyleSheet("min-width: 5px; min-height: 30px; max-width: 5px; max-height: 30px;");
				setObjectName("frameTopLeft");
			break;
			case Qt::TopRightSection:
				setCursor(Qt::SizeBDiagCursor);
				setSizePolicy(QSizePolicy::Maximum,
							  QSizePolicy::Maximum);
				setStyleSheet("min-width: 5px; min-height: 30px; max-width: 5px; max-height: 30px;");
				setObjectName("frameTopRight");
			break;
			case Qt::LeftSection:
				setCursor(Qt::SizeHorCursor);
				setSizePolicy(QSizePolicy::Maximum,
							  QSizePolicy::MinimumExpanding);
				setStyleSheet("min-width: 5px; max-width: 5px;");
				setObjectName("frameLeft");
			break;
			case Qt::RightSection:
				setCursor(Qt::SizeHorCursor);
				setSizePolicy(QSizePolicy::Maximum,
							  QSizePolicy::MinimumExpanding);
				setStyleSheet("min-width: 5px; max-width: 5px;");
				setObjectName("frameRight");
			break;
			case Qt::BottomSection:
				setCursor(Qt::SizeVerCursor);
				setStyleSheet("min-height: 5px; max-height: 5px;");
				setSizePolicy(QSizePolicy::MinimumExpanding,
							  QSizePolicy::Maximum);
				setObjectName("frameBottom");
			break;
			case Qt::BottomLeftSection:
				setCursor(Qt::SizeBDiagCursor);
				setStyleSheet("min-width: 5px; min-height: 5px; max-width: 5px; max-height: 5px;");
				setSizePolicy(QSizePolicy::Maximum,
							  QSizePolicy::Maximum);
				setObjectName("frameBottomLeft");
			break;
			case Qt::BottomRightSection:
				setCursor(Qt::SizeFDiagCursor);
				setStyleSheet("min-width: 5px; min-height: 5px; max-width: 5px; max-height: 5px;");
				setSizePolicy(QSizePolicy::Maximum,
							  QSizePolicy::Maximum);
				setObjectName("frameBottomRight");
			break;
			case Qt::TitleBarArea:
			case Qt::NoSection:
			break;
		}
	}
